//---------------------------------------------------------------------------
#ifndef MainH
#define MainH
//---------------------------------------------------------------------------
#include <Buttons.hpp>
#include <Classes.hpp>
#include <ComCtrls.hpp>
#include <Controls.hpp>
#include <ExtCtrls.hpp>
#include <StdCtrls.hpp>

#include <math.h>
#include <math.hpp>
//#include <complex.h>
#include <Menus.hpp>
//#include <trayicon.h>
#include "xcomplex.h"

//using namespace std;
//typedef complex<double> TValType;

typedef TXComplex TValType;

//---------------------------------------------------------------------------
class TMainForm : public TForm
{
__published:	// IDE-managed Components
    TPanel *Panel2;
    TPanel *Panel3;
    TPanel *Panel1;
    TLabel *Lin1L;
    TLabel *Lin2L;
    TLabel *Lin3L;
    TLabel *Lin4L;
    TLabel *Lin5L;
    TLabel *Lin6L;
    TLabel *Lin7L;
    TLabel *Lin8L;
    TLabel *Lin9L;
    TLabel *Lin10L;
    TScrollBar *Scroll;
    TBitBtn *AngBtn;
    TSpeedButton *BaseBtn;
    TPageControl *PageControl1;
    TTabSheet *BasicPage;
    TTabSheet *AdvPage;
    TBitBtn *BitBtn1;
    TBitBtn *BitBtn2;
    TBitBtn *BitBtn3;
    TBitBtn *BitBtn4;
    TBitBtn *BitBtn5;
    TBitBtn *BitBtn6;
    TBitBtn *BitBtn7;
    TBitBtn *BitBtn9;
    TBitBtn *BitBtn15;
    TBitBtn *BitBtn16;
    TBitBtn *BitBtn8;
    TBitBtn *BitBtn13;
    TBitBtn *BitBtn10;
    TBitBtn *BitBtn11;
    TBitBtn *BitBtn12;
    TBitBtn *BitBtn14;
    TBitBtn *BitBtn19;
    TBitBtn *BitBtn18;
    TBitBtn *BitBtn20;
    TBitBtn *BitBtn24;
    TBitBtn *BitBtn21;
    TTabSheet *AboutPage;
    TPanel *Panel4;
    TLabel *About2Lbl;
    TLabel *About1Lbl;
    TLabel *Label3;
    TLabel *Label4;
    TLabel *LinkLabel;
    TLabel *Label6;
    TPanel *StackPanel;
    TLabel *ID1Label;
    TLabel *ID2Label;
    TLabel *ID3Label;
    TLabel *ID4Label;
    TLabel *ID5Label;
    TLabel *ID6Label;
    TLabel *ID7Label;
    TLabel *ID8Label;
    TLabel *ID9Label;
    TLabel *ID10Label;
    TBitBtn *BitBtn23;
    TBitBtn *BitBtn26;
    TBitBtn *BitBtn29;
    TBitBtn *FormBtn;
    TBitBtn *BitBtn30;
    TSpeedButton *ConvBtn;
    TPopupMenu *PopupMenu;
    TMenuItem *RestoreItem;
    TMenuItem *N1;
    TMenuItem *CloseItem;
    TBitBtn *BitBtn31;
    TBitBtn *BitBtn32;
    TLabel *Label7;
    TTimer *MenuTimer;
    TLabel *Label8;
    TBitBtn *StyleBtn;
    TBitBtn *BitBtn36;
    TBitBtn *BitBtn38;
    TBitBtn *BitBtn39;
    TBitBtn *BitBtn42;
    TBitBtn *BitBtn43;
    TBitBtn *BitBtn44;
    TBitBtn *BitBtn45;
    TBitBtn *BitBtn46;
    TBitBtn *BitBtn25;
    TBitBtn *BitBtn22;
    TBitBtn *BitBtn33;
    TBitBtn *BitBtn34;
    TBitBtn *BitBtn17;
    TBitBtn *BitBtn35;
    TBitBtn *BitBtn27;
    TBitBtn *BitBtn28;
    TLabel *RevLbl;
    TBitBtn *BitBtn37;
    TBitBtn *BitBtn40;
    TBitBtn *BitBtn41;
    TBitBtn *BitBtn47;
    TBitBtn *BitBtn48;
    TBitBtn *BitBtn49;
    TBitBtn *BitBtn50;

    void __fastcall FormKeyPress(TObject *Sender, char &Key);
    void __fastcall FuncExec(TObject *Sender);
    void __fastcall AngBtnClick(TObject *Sender);
    void __fastcall ScrollChange(TObject *Sender);
    void __fastcall BaseBtnClick(TObject *Sender);
    void __fastcall LinkLabelClick(TObject *Sender);
    void __fastcall GetVal(TObject *Sender);
    void __fastcall ConvBtnClick(TObject *Sender);
    void __fastcall BitBtn26Click(TObject *Sender);
    void __fastcall FormBtnClick(TObject *Sender);
    void __fastcall FormKeyDown(TObject *Sender, WORD &Key,
          TShiftState Shift);
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
    void __fastcall RestoreItemClick(TObject *Sender);
    void __fastcall CloseItemClick(TObject *Sender);
    void __fastcall MenuTimerTimer(TObject *Sender);
    void __fastcall StyleBtnClick(TObject *Sender);
    void __fastcall Button1Click(TObject *Sender);

private:	// User declarations
    void __fastcall WndProc(Messages::TMessage &Message);
    void __fastcall ShowHint(TObject*);

public:		// User declarations
//    double            val[32];
    TValType          val[32];
    bool              Editando;
    bool              Decimal;
    int               Expo;
    AnsiString        EditLine;
    AnsiString        ErrText;
    bool              Deg, Rad;
    bool              Cart;

    //
    int        GroupConv;
    int        InConv;
    int        OutConv;

    //
    int        NumBase;

    //itens do menu
    bool       SOT;   //stay on top
    bool       CTT;   //close to tray

    int        Lang; //current language

    //item do stack
    bool       StackEn; //stack enable

    __fastcall TMainForm(TComponent* Owner);
    void __fastcall InfoUpdate(void);
    void __fastcall DelLine(int);
    void __fastcall InsLine(TValType v);
    void __fastcall InsLine(double v);
    void __fastcall ToQ(void);
    void __fastcall Root2(void);
    void __fastcall Root3(void);
    void __fastcall Root4(void);
    void __fastcall DeltaStar(bool dir);
    void __fastcall Determ(void);
    TValType __fastcall DetCalc(int n, TValType *m);
    void __fastcall SaveConfig(void);
    void __fastcall DecTimeCalc(bool dir);
};
//---------------------------------------------------------------------------
extern PACKAGE TMainForm *MainForm;
//---------------------------------------------------------------------------
#endif
